
<include file="Public:header" />
<include file="Public:channel" />
<include file="uc_menu" />
<body>

<script type="text/javascript">
var timeoutid ;
var root_url = "__ROOT__/";
var app_url = "__APP__/";
var url_url = "__URL__/";
$(document).ready(function(){
	
});

	function queryChar(){
		//alert(1);
		name = document.getElementById('char_name').value;
		server = document.getElementById('server').value;
		document.getElementById('error_div').style.display = "none";
		document.getElementById('result').style.display = "none";
		document.getElementById('error').innerHTML = "";
		$.post('__URL__/char_query',{char_name:name,server:server},
			function(s){
				re = eval("("+s+")");
				//alert (re['status']);
				if(re['status'] == "1"){
					
					document.getElementById('result').style.display = "block";
					
					document.getElementById('server_name').innerHTML = re['data']['realm'];
					document.getElementById('guild').innerHTML = re['data']['guildName'];
					document.getElementById('name').innerHTML = re['data']['name'];
					document.getElementById('level').innerHTML = re['data']['level'];
					document.getElementById('class').innerHTML = re['data']['class'];
					document.getElementById('guild_name').value = re['data']['guildName'];
					
					document.getElementById('sub').innerHTML = '<input type="submit" name="char_add" id="char_add" value="提交" >';
				}
				else{
					
					document.getElementById('error_div').style.display = "block";
					document.getElementById('error').innerHTML = re['info'];
				}
				document.getElementById('server').disabled = true;
				document.getElementById('char_name').disabled = true;
				document.getElementById('char_query').disabled = true;
				document.getElementById('res').innerHTML = '<input type="button" name="re" id="re" value="重新查询" >';
				document.getElementById('re').onclick = res;
		});
	}
	
	function res(){
		document.getElementById('sub').innerHTML = "";
		document.getElementById('result').style.display = "none";
		document.getElementById('server_name').innerHTML = "";
		document.getElementById('guild').innerHTML = "";
		document.getElementById('name').innerHTML = "";
		document.getElementById('level').innerHTML = "";
		document.getElementById('class').innerHTML = "";
		document.getElementById('guild_name').value = "";
		document.getElementById('error_div').style.display = "none";
		document.getElementById('error').innerHTML = "";
		
		document.getElementById('server').disabled = false;
		document.getElementById('char_name').disabled = false;
		document.getElementById('char_query').disabled = false;
		document.getElementById('res').innerHTML = "";
	}
	
	function cl(){
		document.getElementById('server').disabled = false;
		document.getElementById('char_name').disabled = false;
		return true;
	}
	
	function set_sig(obj){
		var r = confirm("确定要将 "+obj.value+" 设为签名么？");
		if(r == true){
			
			$.post("__URL__/char_edit",{char_name:obj.value},
				function(s){
					//alert (s);
					var r = eval("("+s+")");
					if(r['status'] == 1){
						alert (r['info']);
					}
					else{
						alert (r['info']);
					}
				}
			);
		}
		else{
			
		}
		
	}
	
	
</script>

<style type="text/css">

</style>


<br><br>
{$msg}
<br><br><br>
<form name="form1" method="post" action="__URL__/Character" onSubmit="return cl();">

	请输入服务器名称:<input type="text" name="server" id="server" value="" >	
	请输入角色名称:<input type="text" name="char_name" id="char_name" value="" >
	<input type="hidden" name="uname" id="uname" value="{$uname}">
	<input type="hidden" name="guild_name" id="guild_name" value="">
	<input type="button" name="char_query" id="char_query" value="查询" onClick="queryChar()">
	<span id="sub"></span>
	<span id="res"></span>
</form>
<div id="result" style="display:none;">

	<span name="queryed" id="server_name" ></span>
	<span name="queryed" id="guild" ></span>
	<span name="queryed" id="name" ></span>
	<span name="queryed" id="level" ></span>
	<span name="queryed" id="class" ></span>

</div>
<div id="error_div" style="display:none;">
<span  id="error"></span>
</div>
<br><br>
<volist name="char" id = "one" >
<b>[{$one.faction}]</b> <a href="http://cn.wowarmory.com/character-sheet.xml?{$one.charUrl}" target="_blank">{$one.name}</a> <b>[{$one.guildName}]</b> 
{$one.battleGroup} | {$one.realm} | {$one.race} | {$one.class} | {$one.level}级 &nbsp;&nbsp;&nbsp;&nbsp;<a href="__URL__/char_del/acc_name/{$uname}/char_name/{$one.name}">删除角色</a> | <input type="radio" name="char_sig" value="{$one.name}" onclick="set_sig(this)" <if condition="$one.Signature eq 1">checked='checked'</if> >设为签名
	<div style="display:{$display};" >	
		<volist name="item_arr[$one['name']]" id = "two">
			<if condition = "$two.id">
			<image src="{$two.backimage}"  height="30" width="30" onmouseover='moin(this,"{$two.id}")' onmouseout='hideItem("{$two.id}")'/>
			<input type="hidden" id="{$two.id}" value="{$two.name}" /> 
			
			</if>
		</volist>
	</div>
	
<br><br>
</volist>

<include file="Public:footer" />